var HOST = 'api.rr.tv';
var TOKENS = [
  '91b7fc36672548259433ca40bc57e6dd',//我的
  '35dafc24e73d461a94c2e69daef72c6b',//我的
  '99ce6f3f7ff840e586958770472ec893',
  '37570aa5dabe44219ab8a13986778390',
  '6f8443b2d6c54d39bf7ab780bb5df3b2',
  '3739e42b649948febad6dbfeaeecddfe',
  'ffeb43e117d744e6822c3fe6abc12dea',
  '5f6d0d3a49e5439e8492515c49b797c5',
  '41d74adccd4b46389882242949e82cea',
  'ff750a61e2684b7d9d4f783b4e3b14b1',
  'f703dcbae2fb42889e8b111829b36167',
  '9aea227ebb224a8b9bea347c13192706',
  '827af86209464b038552a87f1cd546b2',
  'bfc156b8c9ce48d98f2f9e48868130b3',
  'c0a60ecf198d458d83b475e50b8d7893',
  '22f6e8f0fac049849ce6db26535ecf6d',
  'cce5bae0fcdd446fa87f0e61d86cd345',
  'd1f33f20d83441228adf791215308d6d',
  '803db2c8c9de400a9e90f75c2926d98a',
  'b7c4f78d734f48fb871b3c7667f32019',
  '99b3109e62fa4f1eb449182f5428cb84',
  '10347e508c5946ec9116e3044b728f01'
];
var Token_iterator = 0;
//遍历token

function doPostRequest(objClass) {
  var Token = TOKENS[(Token_iterator++) % TOKENS.length];
  var headers = {
    //'Host': HOST,
    'Content-Type': 'application/x-www-form-urlencoded',
    'a': '3f148156-c68e-4958-88a6-6587ca4188f4',
    'b': objClass.uri,
    'c': 'lhy',
    'Accept-Language': 'zh-Hans-CN;q=1, en-CN;q=0.9',
    'clientVersion': '4.0.3',
    'd': '1503884531010',
    'token': Token,
    'deviceId': '3f148156-c68e-4958-88a6-6587ca4188f4',
    'clientType': 'ios_rrmj',
    'e': '4a2b5e96428b0b03dae8b86d53a3c56c72616e8a',
    //'User-Agent': 'PUClient/4.0.3 (iPhone; iOS 9.3.5; Scale/2.00)'
  }
  objClass.paraObj.token = Token;

  wx.request({
    url: 'https://' + HOST + objClass.uri,
    data: objClass.paraObj,
    header: headers,
    success: function (res) {
      objClass.successCallback(res.data);
    },
    fail: function () {
      objClass.successCallback()
    }
  });

}

module.exports = {
  doPostRequest: doPostRequest,
}